home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_07
/
8n07044a
< prev
next >
Wrap
Text File
|
1990-06-17
|
677b
|
28 lines
------------------------------------------------------
LISTING 1
/* TestOpt.c
*/
#include <stdio.h>
#include "Options.h"
void
main( int argc, char **argv){
Options opt;
char *s;
PutArgs( (opt=CreateOptions()), argc, argv);
printf( "-x switch is %s.\n",
IsSwitch( opt, 'x' )?"ON":"OFF");
if( (s=GetParameter(opt,'f')) != NULL )
printf(" -f parameter: '%s'.\n", s);
else printf(" -f parameter omitted.\n");
if( IsMoreSwitches(opt) )
printf("Unrecognized switch character.\n");
printf( "The command line arguements are: ");
while( (s=GetNextOption(opt)) != NULL )
printf( "\t%s", s);
printf(".\n");
DestroyOptions(opt);
}